srGrammar
( "<FileName>" )
or
srGrammar
( "<ActualXmlText>"
)
Loads
grammar for speech recognition in the script.
Parameters
<FileName>
The file containing the grammar.
<ActualXmlText>
Raw XML grammar defined.
Return
Value
Remarks
- This requires SAPI 5.0 SDK to function properly.
- Speech recognition
engine is automatically initialized when
srGrammar() is called for the first time. The maiden initialization is
always slow. To get around this, it is better to call srGrammar("") at
the beginning of the script so that the engine will be initialized even
before the first call is picked up.
Example
srGrammar("abc.xml")
This
loads the grammar from the
file "abc.xml".
srGrammar("<P>Words</P>")
This
loads the grammar provided in the string.
srGrammar("")
This
unloads any existing grammar.
srGrammar("<GRAMMAR LANGID="409"> <DEFINE> <ID NAME="RID_Language" VAL="409"/> </DEFINE>
<RULE ID="RID_Language" TOPLEVEL="ACTIVE"> <LIST PROPID="RID_Language"> <P>zero</P>
<P>one</P> <P>two</P> <P>three</P> <P>four</P> <P>five</P> <P>six</P>
<P>seven</P> <P>eight</P> <P>nine</P> </LIST> </RULE> </GRAMMAR>")
This
loads the grammar for recognizing digits.